<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <div id="app">
        {{address}}
        {{address}}
        {{address}}
        {{address}}
        {{address}}
        {{address}}
    </div>
    <script src="./vue.js"></script>
    <script>
        let vm = new Vue({
            el:'#app',
            data:{
                city:'北京',
                area:'海淀区'
            },
            computed: {
                address(){
                    console.log("======")
                   return `${this.city}-${this.area}` 
                }
            },
            methods:{
                // address(){
                //     console.log("======")
                //    return `${this.city}-${this.area}` 
                // }
            },
            watch:{
                // city(newVal,oldVal){
                //     console.log("newVal",newVal,'oldVal',oldVal)
                //     this.address = `${newVal}-${this.area}`
                // },
                // area(newVal,oldVal){
                //     this.address = `${this.city}-${newVal}`
                // }
            }
        })
    </script>
</body>
</html>